


local mt = ac.skill['点金术']
mt.model1 = [[Abilities\Spells\Other\Transmute\GoldBottleMissile.mdl]]

local gold = {50,100,150,200}
function mt:on_cooldown()
    local hero = self.owner
    local level = math.ceil(ac.enemy.day/4)
    self.data1 = gold[level]
    self:gc(ac.loop(200,function()
        local unit = ac.selector('unit'):enemy(hero):range(hero,1200):filter(function(u)
            return u:is_type('Boss')==false and u:is_type('精英')==false
        end):random()
        if unit and hero:is_alive() then
            self:gc_clear()
            self:cooling()
            hero:launch_missile(unit,self.model1,900,0.15,function()
                unit:kill(hero)
                hero.owner:add('金币',self.data1)
                ac.ui_tag {
                    string = ('|cff00ff00+%0.f|r'):format(self.data1),
                    speed = 200,
                    life = 1,
                    fade = 0.5,
                    position = unit:get_point(),
                    icon = [[图标\金币.blp]],
                }
            end)
        end
    end))
end


local mt = ac.skill['化学狂暴']
mt.temp = '攻击触发'
function mt:on_run()
    local hero = self.owner
    hero:add_buff '化学狂暴'{
        time = 20,
        data1 = self.data1,
        data2 = self.data2,
        data3 = self.data3,
        art = self.art,
    }
end

local buff = ac.buff['化学狂暴']
buff.tip = [[属性提升！]]
buff.data1 = 0
buff.data2 = 0
buff.data3 = 0
buff.effect_data = {
    ['chest left'] = [[Abilities\Spells\Undead\ThornyShield\ThornyShieldTargetChestLeft.mdl]],
    ['chest right'] = [[Abilities\Spells\Undead\ThornyShield\ThornyShieldTargetChestRight.mdl]],
    ['chest mount left'] = [[Abilities\Spells\Undead\ThornyShield\ThornyShieldTargetChestMountLeft.mdl]],
    ['chest mount right'] = [[Abilities\Spells\Undead\ThornyShield\ThornyShieldTargetChestMountRight.mdl]],
}

function buff:on_add()
    local hero = self.owner
    hero:add_animation_properties('alternate')
    self:gc(hero:add('攻击速度',self.data1))
    self:gc(hero:add('移动速度',self.data2))
    self:gc(hero:add('生命恢复加成',self.data3))
    self:gc(function()
        hero:remove_animation_properties('alternate')
    end)
end